<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>IP-MAC 查询</title>
</head>
<body>
    <h2>查询结果</h2>
    <p>你的 IP：{{ ip | tojson }}</p>
    <p id="mac">MAC 地址：<span style="color:#999">查询中...</span></p>
    <p id="raw" style="color:#c00;font-size:14px"></p>

<script>
fetch("/api/mac")
  .then(r => r.json())
  .then(d => {
      const macEl = document.getElementById('mac');
      const rawEl = document.getElementById('raw');
      if (d.mac) {
          macEl.innerHTML = `MAC 地址：<b>${d.mac}</b>`;
          rawEl.textContent = '';
      } else {
          macEl.innerHTML = 'MAC 地址：<b>获取失败</b>';
          rawEl.textContent = d.raw || '';
      }
  });
</script>
</body>
</html>